import logging

import pytest

from api.IhrmLoginApi import IhrmLoginApi
from common.assert_tools import assert_tools
from common.logging_use import init_log_config
from common.read_json_file import read_json_file
from config import BASE_DIR


class TestIhrmLogin(object):
    init_log_config(BASE_DIR + "/data/log/0831.log")
    # 读取json文件
    data = read_json_file((BASE_DIR + "/data/json_data.json"))

    @pytest.mark.parametrize("desc,req_data,status_code,success,code,message", data)
    def test_login(self, desc, req_data, status_code, success, code, message):
        resp = IhrmLoginApi.login(req_data)

        # print(desc, ":", resp.json())
        logging.INFO(resp.json())

        assert_tools(resp, status_code, success, code, message)
        print(status_code,success,code,message)
